package cn.dliyy.warehouse.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.dliyy.base.dao.HQL;
import cn.dliyy.warehouse.bean.Warehouse;
import cn.dliyy.warehouse.dao.EntityDao;

@Service
public class WarehouseService {
	@Resource
	private EntityDao entityDao;
	@Resource
	private HQL hql;

	@Transactional
	public List<Object> getAllList() {
		String s = hql.getListHQL(Warehouse.class);
		List<Object> list = entityDao.createQuery(s);
		return list;
	}
	public List<Object> getList() {
    String s = hql.getListHQL(Warehouse.class);
    s+=" where used=1";
    List<Object> list = entityDao.createQuery(s);
    return list;
  }
	
	public void save(Warehouse warehouse) {
		entityDao.save(warehouse);
	}

	public void update(Warehouse warehouse) {
		entityDao.update(warehouse);
	}

	public void delete(Warehouse warehouse) {
		entityDao.delete(warehouse);
	}
}
